/*
 * @lc app=leetcode.cn id=326 lang=javascript
 *
 * [326] 3 的幂
 */

// @lc code=start
/**
 * @param {number} n
 * @return {boolean}
 */
var isPowerOfThree = function(n) {
    let flag = false
    for (let index = 0; index < 31; index++) {
        if (n === 3**index) {
            flag = true
            break
        }
        if (n < 3**index) {
            flag = false
            break
        }
    }
    return flag
};
// @lc code=end

